Function of: if(/(file|http).*/.test(url)) { }

Posted by WmasterJ on Stack Overflow See other posts from Stack Overflow or by WmasterJ
Published on 2010-06-08T19:32:43Z Indexed on 2010/06/08 19:42 UTC
Read the original article Hit count: 167

Filed under:
|

I am wondering what this technique is called and what it does. It seems to be validating some regular expression on the variable url. I am customizing another persons code:

var url = document.getElementById("editorURL").value;   
if(/(file|http).*/.test(url)) {

}

Maybe someone has a link to an article that explains this a bit more in-depth?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex